package com.uaf.rabbitmq;

import com.transaction.demo.ShopApplication;
import com.transaction.demo.shop.controller.BuyController;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;

@RunWith(SpringRunner.class)
@SpringBootTest(classes = ShopApplication.class, webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
@Slf4j
public class addOrder {

    @Resource
    public BuyController buyController;

    @Test
    public void test() {

        int[][] array = new int[5][5];

        array[0][0] = 1;
        array[1][0] = 1;
        array[1][1] = 1;
        for (int i = 0; i < 5; i++) {

            for (int j = 0; j <= i; j++) {

                if (i != 0 && i != 1) {
                    if(j==0) {
                        array[i][j] = 1;
                    }else {
                        int value = array[i - 1][j] + array[i - 1][j - 1];
                        array[i][j] = value;
                        System.out.println("value==" + value);
                    }
                }


            }
        }

        for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < array[i].length; j++) {
                System.out.print(array[i][j] + " ");
            }
            System.out.println();
        }


//        for (int i = 1; i <= 5; i++) {
//            for (int j = i; j < i; j++) {
//                if (j == 1) {
//                    arr[i][j] = i;
//                } else {
//
//                }
//            }
//        }


//        int[] nums = new int[10];   //声明+创建一个包含10个数的数组
//                nums[0]=1;  //数组下标从0开始，代表给数组的第一个元素赋值

//        BuyReqVo buyReqVo = new BuyReqVo();
//        Result<String> result = buyController.testPay(buyReqVo);
//        log.info("result==" + result);
    }
}
